import os 
path=r'E:\zhujinchao\uterus\cellseg'
for i in os.listdir(path):
    ipath=os.path.join(path,i)
    # print(i)
    dir=ipath+'\\'+'trian'
    dir2=ipath+'\\'+'trianmask'
    ndir=ipath+'\\'+'train'
    ndir2=ipath+'\\'+'trainmask'
    os.rename(dir,ndir)
    os.rename(dir2,ndir2)